using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Text;

namespace Browser.Helpers
{
    public sealed class Utils
    {
        public static string RetrieveUserKey()
        {
            return ConfigurationSettings.AppSettings["UserKey"]; 
            
        }
        public static string RetrieveSecretKey()
        {
            return ConfigurationSettings.AppSettings["SecretKey"]; 
        }
        
        public static byte[] ReadFile(string FilePath)
        {
            
            Stream _stream = new FileStream(FilePath, FileMode.Open, FileAccess.Read);
            byte[] _data = new byte[_stream.Length];
            
            int offset=0;
            int remaining = _data.Length;
            while (remaining > 0)
            {
                int read = _stream.Read(_data, offset, remaining);
                if (read <= 0)
                {
                    throw new EndOfStreamException();
                }
                remaining -= read;
                offset += read;
            }
            
            return _data;
        }
    }
}
